package sharewithus.analyzer.seg;

import gnu.trove.list.linked.TLinkedList;

import java.io.Serializable;
import java.util.List;

import sharewithus.analyzer.POSInf;
import sharewithus.analyzer.PartOfSpeech;

/**
 * 词元token
 * @author terry
 *
 */
public class SUToken implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7865707461726674295L;

	private String term; //词文本
	private List<POSInf> data; // 词性集合
	private int start; // 开始位置
	private int end; // 结束位置
	private PartOfSpeech taggedPOS = PartOfSpeech.UNKNOW;// 已标注的词性

	public static final SUToken START_TOKEN;
	public static final SUToken END_TOKEN;

	static {
		List<POSInf> startData = new TLinkedList<POSInf>();
		startData.add(new POSInf(PartOfSpeech.START, 1, 0));
		START_TOKEN = new SUToken("start", startData, -1, 0);

		List<POSInf> endData = new TLinkedList<POSInf>();
		endData.add(new POSInf(PartOfSpeech.END, 1, 0));
		END_TOKEN = new SUToken("end", endData, -1, 0);
	}

	public SUToken(String term, List<POSInf> data, int start, int end) {
		this.term = term;
		this.data = data;
		this.start = start;
		this.end = end;
	}

	public String toString() {
		return "text:" + term + " start:" + start + " end:" + end
				+ "--------data:" + data;
	}

	public String getTerm() {
		return term;
	}

	public void setTerm(String term) {
		this.term = term;
	}

	public List<POSInf> getData() {
		return data;
	}

	public void setData(List<POSInf> data) {
		this.data = data;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getEnd() {
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}

	public PartOfSpeech getTaggedPOS() {
		return taggedPOS;
	}

	public void setTaggedPOS(PartOfSpeech taggedPOS) {
		this.taggedPOS = taggedPOS;
	}

}
